package ru.lenwp.model;

import java.util.ArrayList;

/**
 * Created by Lenar on 24.06.2014.
 */
public class Account extends EntryWithId{
    private Client client;
    private double sum;
    private boolean block;
    private String number;

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    public double getSum() {
        return sum;
    }

    public void setSum(double sum) {
        this.sum = sum;
    }

    public boolean isBlock() {
        return block;
    }

    public void setBlock(boolean block) {
        this.block = block;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Account account = (Account) o;

        if (block != account.block) return false;
        if (Double.compare(account.sum, sum) != 0) return false;
        if (client != null ? !client.equals(account.client) : account.client != null) return false;
        if (number != null ? !number.equals(account.number) : account.number != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = client != null ? client.hashCode() : 0;
        temp = Double.doubleToLongBits(sum);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (block ? 1 : 0);
        result = 31 * result + (number != null ? number.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Account{" +
                "client=" + client +
                ", sum=" + sum +
                ", block=" + block +
                ", number='" + number + '\'' +
                '}';
    }
}
